# 工厂类支持参数传递
from service.BaseService import BaseService
from service.djjx.DjjxService import DjjxService
from service.lbw.LbwService import LbwService
from service.tjyl.TjylService import TjylService
from service.tjyz.TjyzService import TjyzService
from service.ztep.ZtepService import ZtepService


class ServiceFactory:
    _registry = {
        "tjyz": TjyzService,
        "ztep": ZtepService,
        "djjx": DjjxService,
        "lbw": LbwService,
        "tjyl":TjylService
    }

    @classmethod
    def get_service(cls, server_name: str) -> BaseService:
        service_class = cls._registry.get(server_name)

        if not service_class:
            raise ValueError(f"Unknown service type: {server_name}")  # 修复错误信息

        return service_class()
